import time
from selenium.webdriver.common.by import By
from common.Utils import ChatroomDriver
#测试聊天详情页面

class ChatList:
    url = ""
    driver = ""
    def __init__(self):
        self.url = "http://127.0.0.1:8080/client.html"
        self.driver = ChatroomDriver.driver
        self.driver.get(self.url)

    # 登录状态下
    def ListTestByLogin(self):
        # 检查元素
        # 个人信息
        self.driver.find_element(By.CSS_SELECTOR,"body > div.client-container > div > div.left > div.user")
        # 搜索框
        self.driver.find_element(By.CSS_SELECTOR,"body > div.client-container > div > div.left > div.search > input[type=text]")
        # 搜索按钮
        self.driver.find_element(By.CSS_SELECTOR, "body > div.client-container > div > div.left > div.search > button")
        # 聊天列表按钮
        self.driver.find_element(By.CSS_SELECTOR, "body > div.client-container > div > div.left > div.tab > div.tab-session")
        # 联系人列表按钮
        self.driver.find_element(By.CSS_SELECTOR, "body > div.client-container > div > div.left > div.tab > div.tab-friend")
        # 聊天人名称
        self.driver.find_element(By.CSS_SELECTOR, "#session-list > li.selected > h3")
        # 最近聊天内容
        self.driver.find_element(By.CSS_SELECTOR, "#session-list > li.selected > p")
        # 添加屏幕截图
        ChatroomDriver.getScreeShot()
        self.driver.back()

list=ChatList()
# list.ListTestByLogin()
